package org.come.login;

import com.gl.util.Xy2Util;
import com.tool.image.Creepsskin;
import com.tool.tcp.NewPart;
import com.tool.tcp.PartOne;
import com.tool.tcp.Sprite;
import com.tool.tcp.SpriteFactory;
import com.tool.tcpimg.UIUtils;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.math.BigDecimal;
import java.util.Map;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import javax.swing.text.Document;

import org.come.bean.ConfigureBean;
import org.come.model.Configure;
import org.come.until.Music;
import org.come.until.UserMessUntil;
import org.come.until.Util;
import org.come.view.View;

public class CreateView extends View {
	// 4族按钮
	private SpriteBtn[] leibtns;
	// 6个选择按钮角色
	private SpriteBtn[] rolebtns;
	// 创建角色框
	private SpriteBtn creat;
	// 输入框
	private SpriteBtn creat1;
	// 武器0左1右 坐骑2左3右 动作4左5右 时装6左7右 8左调整方向 9右调整方向 10创建角色 12进入游戏 13进入创建角色界面
	private SpriteBtn[] creatbtns;
	// 11返回
	private SpriteBtn fanghui;
	// 种族特点
	private SpriteBtn trait;
	// 人物图片
	private SpriteBtn roleimg;
	// 人物描述
	private SpriteBtn roletext;
	// 随机名字
	private SpriteBtn suiji;
	//	// 人物动画
//	private SpriteBtn role;
	// 武器选择
	private String[] Weapons;
	// 动作选择
	private String[] Actions = { "站立=stand", "跑=run", "走=walk", "防御=defend", "物理攻击=attack", "法术攻击=magic", "被攻击=hit", "死亡=die", "攻击跑=attackrun", "进入战斗=guard" };
	// 角色列表 人族
	private String[] roleren = { "逍遥生", "剑侠客", "猛壮士", "俏千金", "飞燕女", "英女侠" };
	// 角色列表 魔族
	private String[] rolemo = { "巨魔王", "夺命妖", "虎头怪", "狐美人", "骨精灵", "小蛮妖" };
	// 角色列表 仙族
	private String[] rolexian = { "神天兵", "龙战将", "智圣仙", "舞天姬", "精灵仙", "玄剑娥" };
	// 角色列表 鬼族
	private String[] rolegui = { "猎魂引", "无崖子", "祭剑魂", "夜溪灵", "幽梦影", "墨衣行" };
	// 角色列表 龙族
	private String[] rolelong = { "沧浪君", "龙渊客", "忘忧子", "骊珠儿", "木兰行", "莫解语" };
	// 坐骑列表
	private String[] Mounts = { "无", "一坐骑", "二坐骑", "三坐骑", "四坐骑", "五坐骑", "六坐骑" , "七坐骑" };
	// 时装列表
	private String[] Fashions = { "无" };
	// 方向列表
	private String[] dirs = { "4", "0", "7", "3", "6", "2", "5", "1" };
	// 显示武器
	private JLabel Weapon;
	// 显示动作
	private JLabel Action;
	// 显示坐骑
	private JLabel Mount;
	// 显示时装
	private JLabel Fashion;
	// 名称输入
	public static JTextField textAccount;
	// 背景图片
	private ImageIcon beijing;
	//提示字
	private String msg;

	public static String zzs = "5";

	private String checked;

	public String getChecked(){
		return this.checked;
	}

	public void setChecked(String checked){
		this.checked = checked;
	}
	public CreateView(LoginJpanel loginJpanel) {
		// TODO Auto-generated constructor stub
		this(loginJpanel, 0);
	}
	public CreateView(LoginJpanel loginJpanel,int v) {
		// TODO Auto-generated constructor stub
		this.setBounds(0, 0, 1024, 720);
		fanghui = new SpriteBtn("resource/NewUi/返回按钮全新", 10, 680, false);
		fanghui.setBounds(10, 680, 60, 30);
		fanghui.addMouseListener(new RoleMouslisten(11, fanghui, loginJpanel));
		this.add(fanghui);
		creat = new SpriteBtn("resource/NewUi/展示面板新", 768, 572, false);
		creat1 = new SpriteBtn("resource/NewUi/打字面板", 376, 556, false);
		Weapon = new JLabel();
		Weapon.setText("无");
		Weapon.setHorizontalAlignment(SwingConstants.CENTER);
		Weapon.setFont(UIUtils.TEXT_FONT);
		Weapon.setForeground(Color.white);
		Weapon.setBounds(832, 591, 70, 25);
		this.add(Weapon);
		Mount = new JLabel();
		Mount.setText("坐骑一");
		Mount.setHorizontalAlignment(SwingConstants.CENTER);
		Mount.setFont(UIUtils.TEXT_FONT);
		Mount.setForeground(Color.white);
		Mount.setBounds(950, 591, 70, 25);
		this.add(Mount);
		Action = new JLabel();
		Action.setText("无");
		Action.setHorizontalAlignment(SwingConstants.CENTER);
		Action.setFont(UIUtils.TEXT_FONT);
		Action.setForeground(Color.white);
		Action.setBounds(832, 611, 70, 25);
		this.add(Action);
		Fashion = new JLabel();
		Fashion.setText("无");
		Fashion.setHorizontalAlignment(SwingConstants.CENTER);
		Fashion.setFont(UIUtils.TEXT_FONT);
		Fashion.setForeground(Color.white);
		Fashion.setBounds(950, 611, 70, 25);
		this.add(Fashion);
		textAccount = new JTextField();
		textAccount.setBounds(379, 559, 155, 23);
		textAccount.setOpaque(false);
		textAccount.setBorder(BorderFactory.createEmptyBorder());
		textAccount.setForeground(Color.WHITE);
		textAccount.setFont(UIUtils.TEXT_FONT);
		textAccount.setCaretColor(Color.WHITE);// 设置光标颜色为白色
		textAccount.getDocument().addDocumentListener(new DocumentListener() {
			@Override
			public void removeUpdate(DocumentEvent e) {
				if (Util.special(textAccount.getText())) {
					if (textAccount.getText().getBytes().length <= 18) {
						CreateView.this.msg = null;
					} else {
						CreateView.this.msg = "角色名字超长了!!!";
					}
				}
				else {
					CreateView.this.msg = "角色名字不能包含特殊字符!!!";
				}
			}
			@Override
			public void insertUpdate(DocumentEvent e) {
				if (Util.special(textAccount.getText())) {
					if (textAccount.getText().getBytes().length <= 18) {
						CreateView.this.msg = null;
					} else {
						CreateView.this.msg = "角色名字超长了!!!";
					}
				}
				else {
					CreateView.this.msg = "角色名字不能包含特殊字符!!!";
				}
			}
			@Override
			public void changedUpdate(DocumentEvent e) {
				// TODO Auto-generated method stub

			}
		});
		this.add(textAccount);
		ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
		Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
		Configure configure = item.get(new BigDecimal(1));
		if(configure.getLzjskg() != null) {
			zzs = configure.getLzjskg();
		}
		if("4".equals(zzs)) {
			leibtns = new SpriteBtn[4];
		}else if("3".equals(zzs)) {
			leibtns = new SpriteBtn[3];
		}else {
			leibtns = new SpriteBtn[5];
		}

		for (int i = 0; i < leibtns.length; i++) {
			leibtns[i] = new SpriteBtn("resource/NewRoleUi/" + LoginJpanel.leipath(i) + "族按钮", i * 110 + 10, 0, true, 1, 120, 120);
			leibtns[i].setBounds(i * 110 + 10, 0, 80, 80);
			leibtns[i].addMouseListener(new RaceMouslisten(i,leibtns[i],loginJpanel));
			this.add(leibtns[i]);
		}
		creatbtns = new SpriteBtn[11];
		for (int i = 0; i < creatbtns.length; i++) {
			if (i < 8) {
				if (i % 2 == 0) {
					creatbtns[i] = new SpriteBtn("resource/NewUi/向左新", 792 + i % 4 / 2 * 120, 595 + (i / 4) * 20, false);
					creatbtns[i].setBounds(794 + i % 4 / 2 * 120, 595 + (i / 4) * 20, 20, 20);
				} else {
					creatbtns[i] = new SpriteBtn("resource/NewUi/向右新", 882 + i % 4 / 2 * 120, 595 + (i / 4) * 20, false);
					creatbtns[i].setBounds(886 + i % 4 / 2 * 120, 595 + (i / 4) * 20, 20, 20);
				}
			} else if (i == 8) {
				// 左右调整方向
				creatbtns[i] = new SpriteBtn("resource/NewUi/方向向左新", 400, 450, false);
				creatbtns[i].setBounds(400, 450, 30, 20);
			} else if (i == 9) {
				creatbtns[i] = new SpriteBtn("resource/NewUi/方向向右新", 550, 450, false);
				creatbtns[i].setBounds(550, 450, 30, 20);
			} else if (i == 10) {
				// 创建
				creatbtns[i] = new SpriteBtn("resource/NewUi/进入1", 537, 554, false);
				creatbtns[i].setBounds(537, 554, 90, 35);
			}
			creatbtns[i].addMouseListener(new RoleMouslisten(i, creatbtns[i], loginJpanel));
			this.add(creatbtns[i]);
		}
		this.suiji = new SpriteBtn("resource/NewUi/create-role-dice.was", 349, 557, false);
		this.suiji.setBounds(349, 557, 40, 40);
		this.suiji.addMouseListener(new RoleMouslisten(15, this.suiji, loginJpanel));
		add(this.suiji);
		xzRace(v, loginJpanel);
		xzRole(0);
	}
	/**选中*/
	public void xzRace(int v,LoginJpanel loginJpanel){
		LoginJpanel.quxiao(leibtns, v);
		String race=LoginJpanel.leipath(v);
		beijing = new ImageIcon("resource/NewUi/" + race + ".png");
		trait = new SpriteBtn("resource/NewRoleUi/" + race + "族特点", 420, 120, false);
		if (rolebtns==null) {
			rolebtns = new SpriteBtn[6];
		}
		for (int i = 0; i < rolebtns.length; i++) {
			if (rolebtns[i]==null) {
				rolebtns[i] = new SpriteBtn("resource/NewRoleUi/角色按钮_" + rolename(race, i), 0, 110 + i * 75, true, 1, 120, 120);
				rolebtns[i].setBounds(0, 110 + i * 75, 200, 70);
				rolebtns[i].addMouseListener(new CreateMouslisten(i, rolebtns[i], loginJpanel));
				this.add(rolebtns[i]);
			}else {
				rolebtns[i].setSprite("resource/NewRoleUi/角色按钮_" + rolename(race, i));
			}
		}
	}
	/**角色选中*/
	public void xzRole(int zhi) {
		LoginJpanel.quxiao(rolebtns, zhi);
		roletext = new SpriteBtn("resource/NewRoleUi/角色描述_" + rolename(SelectedLei(), zhi), 900, 335, false);
		if (!"龙".equals(SelectedLei())) {
			roleimg = new SpriteBtn("resource/NewRoleUi/角色图片_" + rolename(SelectedLei(), zhi), 600, 10, false);
		} else {
			if (roleimg == null || roleimg.getSx() != 0) {
				roleimg = new SpriteBtn("resource/NewRoleUi/01", 300, 150, false);
			}
		}
		// 先初始化武器列表
		GetWeapons(SelectedRole());
		ModifyAction(0, -1);
		ModifyMount(0, -1);
		ModifyWeapon(0, -1);
		ModifyFashion(0, -1);
		roletcp();
	}
	/**获取对应种族对应位置的人物名称*/
	public String rolename(String lei, int i) {
		if ("人".equals(lei)) {
			return roleren[i];
		} else if ("魔".equals(lei)) {
			return rolemo[i];
		} else if ("仙".equals(lei)) {
			return rolexian[i];
		} else if ("鬼".equals(lei)) {
			return rolegui[i];
		} else {
			return rolelong[i];
		}
	}
	/**根据当前选择显示人物tcp 先坐骑 有坐骑不考虑武器*/
	public void roletcp() {
		// 获取角色名
		if (!"无".equals(GetdqMount())) {
			BigDecimal se=new BigDecimal(SelectedRoleID());
			int mountId=1;
			if (GetdqMount().startsWith("二")) {mountId=2;}
			else if (GetdqMount().startsWith("三")) {mountId=3;}
			else if (GetdqMount().startsWith("四")) {mountId=4;}
			else if (GetdqMount().startsWith("五")) {mountId=5;}
			else if (GetdqMount().startsWith("六")) {mountId=6;}
			else if (GetdqMount().startsWith("七")) {mountId=7;}
			part=SpriteFactory.createPart((long)mountId<<40|se.longValue(), GetdqActionIntTwo(), 1, null);
		} else {
			String weapon=GetdqWeapon();
			long type=0;
			if ("剑".equals(weapon)) {type=1;}
			else if ("扇".equals(weapon)) {type=2;}
			else if ("锤".equals(weapon)) {type=3;}
			else if ("斧头".equals(weapon)) {type=4;}
			else if ("拳套".equals(weapon)) {type=5;}
			else if ("书".equals(weapon)) {type=6;}
			else if ("棍".equals(weapon)) {type=7;}
			else if ("鞭".equals(weapon)) {type=8;}
			else if ("钩".equals(weapon)) {type=9;}
			else if ("刀".equals(weapon)) {type=10;}
			else if ("双环".equals(weapon)) {type=11;}
			else if ("枪".equals(weapon)) {type=12;}
			else if ("幡".equals(weapon)) {type=13;}
			else if ("爪".equals(weapon)) {type=14;}
			else if ("浮尘".equals(weapon)) {type=15;}
			else if ("飘带".equals(weapon)) {type=16;}
			else if ("灯笼".equals(weapon)) {type=17;}
			else if ("弓".equals(weapon)) {type=18;}
			part=SpriteFactory.createPart(type<<32|SelectedRoleID(), GetdqActionIntTwo(), 1, null);
			//part=SpriteFactory.createPart(19L<<32|21005, GetdqActionIntTwo(), 1, null);
		}
	}
	/**修改动作显示 zhi不为-1为修改指定位置动作 sx-1为不操作 0左 1右*/
	public void ModifyAction(int zhi, int sx) {
		if (zhi != -1) {
			Action.setText(Actions[zhi].split("=")[0]);
			return;
		} else {
			if ("无".equals(GetdqMount())) {
				Action.setText(getshuzu(Actions, Actions[GetdqActionInt()], sx).split("=")[0]);
				return;
			} else {
				String[] zhu = { "站立=stand", "跑=run" };
				Action.setText(getshuzu(zhu, Actions[GetdqActionInt()], sx).split("=")[0]);
			}
		}
	}
	/**修改坐骑显示*/
	public void ModifyMount(int zhi, int sx) {
		if (zhi != -1) {
			Mount.setText(Mounts[zhi]);
			if (!"无".equals(Mount.getText())) {
				ModifyAction(0, -1);
			}
			return;
		} else {
			Mount.setText(getshuzu(Mounts, Mount.getText(), sx));
			if (!"无".equals(Mount.getText())) {
				ModifyAction(0, -1);
			}
			return;
		}
	}
	/**修改武器显示*/
	public void ModifyWeapon(int zhi, int sx) {
		if (zhi != -1) {
			Weapon.setText(Weapons[zhi]);
			return;
		} else {
			Weapon.setText(getshuzu(Weapons, Weapon.getText(), sx));
		}
	}
	/**修改时装显示*/
	public void ModifyFashion(int zhi, int sx) {
		return;
	}
	/**修改方向显示*/
	public void ModifyDir(int zhi, int sx) {
		if (zhi != -1) {
			dir=Integer.parseInt(dirs[zhi]);
		} else {
			dir=Integer.parseInt(getshuzu(dirs, getdir(), sx));
		}
	}
	/**根据列表 和字段 操作返回 值 0左 1右*/
	public String getshuzu(String[] zhu, String zhi, int sx) {
		int weizhi = 0;
		for (int i = 0; i < zhu.length; i++) {
			if (zhu[i].equals(zhi)) {
				weizhi = i;
				break;
			}
		}
		if (sx == 0) {
			weizhi--;
		} else {
			weizhi++;
		}
		if (weizhi < 0) {
			weizhi = zhu.length - 1;
		} else if (weizhi > zhu.length - 1) {
			weizhi = 0;
		}
		return zhu[weizhi];
	}
	/**获取当前角色的武器列表*/
	public void GetWeapons(String rolename) {
		if ("纯阳子".equals(rolename)) {
			Weapons=new String[]{"扇","书"};
		}else if ("夺命妖".equals(rolename)) {
			Weapons=new String[]{"刀","幡"};
		}else if ("飞剑侠".equals(rolename)) {
			Weapons=new String[]{"剑","拳套"};
		}else if ("飞燕女".equals(rolename)) {
			Weapons=new String[]{"鞭","钩"};
		}else if ("骨精灵".equals(rolename)) {
			Weapons=new String[]{"剑","棍"};
		}else if ("红拂女".equals(rolename)) {
			Weapons=new String[]{"剑","鞭"};
		}else if ("狐美人".equals(rolename)) {
			Weapons=new String[]{"爪","鞭"};
		}else if ("虎头怪".equals(rolename)) {
			Weapons=new String[]{"棍","枪"};
		}else if ("混天魔".equals(rolename)) {
			Weapons=new String[]{"刀","斧头"};
		}else if ("祭剑魂".equals(rolename)) {
			Weapons=new String[]{"刀","剑"};
		}else if ("剑侠客".equals(rolename)) {
			Weapons=new String[]{"锤","剑"};
		}else if ("精灵仙".equals(rolename)) {
			Weapons=new String[]{"刀","拳套"};
		}else if ("镜花影".equals(rolename)) {
			Weapons=new String[]{"剑","飘带"};
		}else if ("九尾狐".equals(rolename)) {
			Weapons=new String[]{"钩","爪"};
		}else if ("巨魔王".equals(rolename)) {
			Weapons=new String[]{"刀","枪"};
		}else if ("绝影魔".equals(rolename)) {
			Weapons=new String[]{"刀","枪"};
		}else if ("猎魂引".equals(rolename)) {
			Weapons=new String[]{"枪","拳套"};
		}else if ("玲珑女".equals(rolename)) {
			Weapons=new String[]{"鞭","刀"};
		}else if ("龙战将".equals(rolename)) {
			Weapons=new String[]{"棍","爪"};
		}else if ("媚灵狐".equals(rolename)) {
			Weapons=new String[]{"刀","双环"};
		}else if ("猛壮士".equals(rolename)) {
			Weapons=new String[]{"斧头","拳套"};
		}else if ("墨衣行".equals(rolename)) {
			Weapons=new String[]{"鞭","钩"};
		}else if ("南冠客".equals(rolename)) {
			Weapons=new String[]{"刀","剑"};
		}else if ("霓裳仙".equals(rolename)) {
			Weapons=new String[]{"灯笼","飘带"};
		}else if ("逆天魔".equals(rolename)) {
			Weapons=new String[]{"斧头","棍"};
		}else if ("俏千金".equals(rolename)) {
			Weapons=new String[]{"刀","枪"};
		}else if ("青阳使".equals(rolename)) {
			Weapons=new String[]{"枪","棍"};
		}else if ("神天兵".equals(rolename)) {
			Weapons=new String[]{"锤","枪"};
		}else if ("神秀生".equals(rolename)) {
			Weapons=new String[]{"棍","剑"};
		}else if ("霜月灵".equals(rolename)) {
			Weapons=new String[]{"刀","钩"};
		}else if ("无崖子".equals(rolename)) {
			Weapons=new String[]{"幡","书"};
		}else if ("武尊神".equals(rolename)) {
			Weapons=new String[]{"枪","爪"};
		}else if ("舞天姬".equals(rolename)) {
			Weapons=new String[]{"棍","飘带"};
		}else if ("逍遥生".equals(rolename)) {
			Weapons=new String[]{"剑","扇"};
		}else if ("小蛮妖".equals(rolename)) {
			Weapons=new String[]{"刀","钩"};
		}else if ("玄剑娥".equals(rolename)) {
			Weapons=new String[]{"剑","枪"};
		}else if ("玄天姬".equals(rolename)) {
			Weapons=new String[]{"双环","飘带"};
		}else if ("燕山雪".equals(rolename)) {
			Weapons=new String[]{"刀","剑"};
		}else if ("夜溪灵".equals(rolename)) {
			Weapons=new String[]{"灯笼","双环"};
		}else if (rolename.equals("临九渊")) {
			Weapons=new String[]{"灯笼","飘带"};
		} else if (rolename.equals("游无极")) {
			Weapons=new String[]{"刀","剑"};
		}else if (rolename.equals("英女侠")) {
			Weapons=new String[]{"刀","棍"};
		}else if ("幽梦影".equals(rolename)) {
			Weapons=new String[]{"双环","飘带"};
		}else if ("云中君".equals(rolename)) {
			Weapons=new String[]{"双环","飘带"};
		}else if ("智圣仙".equals(rolename)) {
			Weapons=new String[]{"浮尘","剑"};
		}else if ("紫薇神".equals(rolename)) {
			Weapons=new String[]{"幡","剑"};
		}else if ("沧浪君".equals(rolename)) {
			Weapons=new String[]{"书","剑"};
		}else if ("莫解语".equals(rolename)) {
			Weapons=new String[]{"灯笼","剑"};
		}else if ("龙渊客".equals(rolename)) {
			Weapons=new String[]{"枪","刀"};
		}else if ("忘忧子".equals(rolename)) {
			Weapons=new String[]{"弓","双环"};
		}else if ("骊珠儿".equals(rolename)) {
			Weapons=new String[]{"锤","钩"};
		}else if ("木兰行".equals(rolename)) {
			Weapons=new String[]{"弓","枪"};
		}
	}
	/**获取当前动作*/
	public String GetdqAction() {
		return Action.getText();
	}
	/**获取当前动作属于第几个*/
	public int GetdqActionIntTwo() {
		String dq = GetdqAction()+"=";
		for (int i = 0; i < Actions.length; i++) {
			if (Actions[i].startsWith(dq)) {
				dq=Actions[i].substring(dq.length());
				break;
			}
		}
		for (int i = 0; i < SpriteFactory.ActionType.length; i++) {
			if (dq.equals(SpriteFactory.ActionType[i])) {
				return i;
			}
		}
		return 0;
	}
	/**获取当前动作属于第几个*/
	public int GetdqActionInt() {
		String dq = GetdqAction();
		for (int i = 0; i < Actions.length; i++) {
			if (Actions[i].split("=")[0].equals(dq)) {
				return i;
			}
		}
		return 0;
	}
	/**获取当期武器*/
	public String GetdqWeapon() {
		return Weapon.getText();
	}
	/**获取当期坐骑*/
	public String GetdqMount() {
		return Mount.getText();
	}
	/**获取当期的方向*/
	public String getdir() {
		return dir + "";
	}
	/**获取选中人物角色id*/
	public int SelectedRoleID(){
		String role=SelectedRole();
		return Creepsskin.getLocalID(role);
	}
	/**获取选中的人物*/
	public String SelectedRole() {
		for (int i = 0; i < rolebtns.length; i++) {
			if (rolebtns[i].getZhen() == 2) {
				return rolename(SelectedLei(), i);
			}
		}
		return "逍遥生";
	}
	/**获取选中的种族*/
	public String SelectedLei() {
		for (int i = 0; i < leibtns.length; i++) {
			if (leibtns[i].getZhen() == 2) {
				return LoginJpanel.leipath(i);
			}
		}
		return "人";
	}
	/**
	 * 左右按钮 武器0左1右 坐骑2左3右 动作4左5右 时装6左7右
	 */
	public void btnAbout(int i) {
		switch (i) {
			case 0:
				ModifyWeapon(-1, 0);
				break;
			case 1:
				ModifyWeapon(-1, 1);
				break;
			case 2:
				ModifyMount(-1, 0);
				break;
			case 3:
				ModifyMount(-1, 1);
				break;
			case 4:
				ModifyAction(-1, 0);
				break;
			case 5:
				ModifyAction(-1, 1);
				break;
			case 6:
				ModifyFashion(-1, 0);
				break;
			case 7:
				ModifyFashion(-1, 1);
				break;
		}
		roletcp();
	}

	private NewPart part;
	private long time=0;
	private int dir=4;
	@Override
	protected void paintComponent(Graphics g) {
		// TODO Auto-generated method stub
		super.paintComponent(g);
		g.drawImage(beijing.getImage(), 0, 0, 1024, 720, null);
		roleimg.draw(g);
		roletext.draw(g);
		trait.draw(g);
		this.suiji.draw(g);
		creat1.draw(g);
		for (int i = 0; i < leibtns.length; i++) {
			leibtns[i].draw(g);
		}
		for (int i = 0; i < rolebtns.length; i++) {
			rolebtns[i].draw(g);
		}
		creat.draw(g);
		for (int i = 0; i < creatbtns.length; i++) {
			creatbtns[i].draw(g);
		}
		fanghui.draw(g);
		if (part!=null) {
			time+=30;
			part.draw(g, 500, 450, dir, time);
		}
		if (msg != null) {
			g.setFont(UIUtils.TEXT_BOLD_FONT);
			g.setColor(Color.red);
			g.drawString(msg, 440, 520);
		}
	}
	public String getMsg() {
		return msg;
	}
	public void setMsg(String msg) {
		this.msg = msg;
	}
	public JTextField getTextAccount() {
		return textAccount;
	}
	public void setTextAccount(JTextField textAccount) {
		CreateView.textAccount = textAccount;
	}

}
